import java.io.BufferedReader;
import java.io.FileReader;

public class ianxisan {
    public static void main(String[] args) {
        try {
            BufferedReader buf=new BufferedReader(new FileReader("C:\\1.1\\3.txt"));
            String s=null;

            while ((s=buf.readLine())!=null){
                if(s.contains("TMD")|s.contains("SB")){
                    String tmd = s.replace("TMD", "***");
                    if (tmd.contains("SB")) {
                        tmd = tmd.replace("SB", "**");
                    }
                    System.out.println(tmd);
                }else {
                    System.out.println(s);
                }

            }


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
